package cn.edu.zafu.bigdata.fui;

public class AnimalExtend {
    public static void main(String[] args) {
        Dog dog = new Dog("Dog");
        dog.makeSound();

        Cat cat = new Cat("Cat");
        cat.makeSound();
    }
}
class Animal {
    private String name;

    public void setName (String name){
        this.name = name;
    }
    public Animal(){
    }

    public Animal(String name){
        this.name = name;
    }
    public String getName(){
        return this.name;
    }
    public void makeSound(){
         System.out.println( getName() +":"+"makes sound");
    }
}
class Dog extends Animal{
    public Dog(String name){
        super(name);
    }
    @Override
    public void makeSound(){
        System.out.println(super.getName()+":"+"Woof");
    }
}
class Cat extends Animal{
    public Cat(String name){
        super(name);
    }
    @Override
    public void makeSound(){
        System.out.println(super.getName()+":"+"Meow");
    }
}